<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/common/default.jsp"%>
<html>
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link type="text/css" rel="stylesheet" href="${ctx}/static/tools/jquery-validationEngine/validationEngine.jquery.css"></link>
	</head>
	<body>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine.js"></script>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine-cn.js"></script>
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
								try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
	
			<ul class="breadcrumb">
				<li><i class="icon-home home-icon"></i>首页</li>
				<li>系统管理</li>
				<li><a href="${ctx}/sys/user/updatePwd">修改密码</a></li>
			</ul>
			<!-- .breadcrumb -->
		</div>
		<div class="page-content">
			<div class="page-header">
					<h1>修改密码
						<small>
						<i class="icon-double-angle-right"></i>
						</small>					
					</h1>			
				</div> 
				
			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<form class="form-horizontal" role="form" onsubmit="return sysUserfoModify();" id="userForm"  name="userForm" method="post">
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 原密码：</label>
							<div class="col-sm-9">
								<input type="password" id="oldPassword" name="oldPassword"  required maxlength="50" class="col-xs-10 col-sm-3" />
							</div>
						</div>
						<div class="space-4"></div>
						
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 新密码：</label>
							<div class="col-sm-9">
								<input type="password" id="newPassword" name="newPassword"  required maxlength="50" class="col-xs-10 col-sm-3" />
							</div>
						</div>
						
						<div class="clearfix form-actions">
							<div class="col-md-offset-3 col-md-9">
								<button class="btn btn-info" type="submit">
									<i class="icon-ok bigger-110"></i>提交
								</button>
							</div>
						</div>
						
					</form>
				</div>
			</div>
						
		</div>
		<script type="text/javascript">
			//项目基本信息修改
			function sysUserfoModify(){
				var datastr = new Object();
    			datastr.oldPassword = $('#oldPassword').val();
    			datastr.newPassword = $('#newPassword').val();
				var result = true;
				
 				if ($("#userForm").validationEngine("validate")) {
					$.ajax({
    		        async: true,
    		        type:"POST",
    		        data:JSON.stringify(datastr),
    		        url: "${ctx}/sys/user/toUpdatePwd",
    		        dataType: "json",
    		        headers : {  
                        'Content-Type' : 'application/json;charset=utf-8'  
                    },
                    success : function(data) {
                		if (data != undefined && data.status != undefined
                				&& data.status.trim() == '0') {
                			result = true;
                			alert("密码修改成功！");
                		} else {
                			result = false;
                			alert(data.error);
                		}
                	},
    			},"json");
 				}
				return false;		
			}
		</script>
	</body>
</html>